<p class="rightTop"></p>
<?php

 switch($_POST['toolname']){
					case 'manipulation':

					require "include/seq.bio.inc.php";
					require "include/seq.gfx.inc.php";
					switch($_REQUEST['addedaction']){
					case 'belassen':
						$dna_seq = new DNASEQUENCE($_POST["sequence"]);
						$drawer = new SequenceDrawer();
						echo "<h1>Hier Ihre DNA-Sequenz als Grafik:</h1><br/>";
						$drawer->draw_dna_sequence($dna_seq->getseq());
						echo "<p class=\"rightTxt\"><br/><br/>Die ursprüngliche Sequenz lautete:<br/><code2>";
						$drawer->print_dna_sequence($dna_seq->getseq("?",true, false));
						echo "</code2><br/>Ihre Sequenz hat eine Länge von ";
						echo $dna_seq->getseq_length();
						echo " Basen!</p>";break;
					case 'umkehren':
						$dna_seq = new DNASEQUENCE($_POST["sequence"]);
						$dna_seq->reverse();
						$drawer = new SequenceDrawer();
						echo "<h1>Hier Ihre DNA-Sequenz als Grafik:</h1><br/>";
						$drawer->draw_dna_sequence($dna_seq->getseq());
						echo "<p class=\"rightTxt\"><br/><br/>Die umgekehrte Sequenz lautet:<br/><code>";
						$drawer->print_dna_sequence($dna_seq->getseq());
						echo "</code><br/>Die ursprüngliche Sequenz lautete:<br/><code2>";
						$drawer->print_dna_sequence($dna_seq->getseq("?",true, false));
						echo "</code2><br/>Ihre Sequenz hat eine Länge von ";
						echo $dna_seq->getseq_length();
						echo " Basen!</p>";break;
					case 'komplementieren':
						$dna_seq = new DNASEQUENCE($_POST["sequence"]);
						$dna_seq->complement();
						$drawer = new SequenceDrawer();
						echo "<h1>Hier Ihre DNA-Sequenz als Grafik:</h1><br/>";
						$drawer->draw_dna_sequence($dna_seq->getseq());
						echo "<p class=\"rightTxt\"><br/><br/>Die komplementare Sequenz lautet:<br/><code>";
						$drawer->print_dna_sequence($dna_seq->getseq());
						echo "</code><br/>Die ursprüngliche Sequenz lautete:<br/><code2>";
						$drawer->print_dna_sequence($dna_seq->getseq("?",true, false));
						echo "</code2><br/>Ihre Sequenz hat eine Länge von ";
						echo $dna_seq->getseq_length();
						echo " Basen!</p>";break;
				   case 'umkehren und komplement.':
						$dna_seq = new DNASEQUENCE($_POST["sequence"]);
						$dna_seq->complement();
						$dna_seq->reverse();
						$drawer = new SequenceDrawer();
						echo "<h1>Hier Ihre DNA-Sequenz als Grafik:</h1><br/>";
						$drawer->draw_dna_sequence($dna_seq->getseq());
						echo "<p class=\"rightTxt\"><br/><br/>Die komplementare und umgekehrte Sequenz lautet:<br/><code>";
						$drawer->print_dna_sequence($dna_seq->getseq());
						echo "</code><br/>Die ursprüngliche Sequenz lautete:<br/><code2>";
						$drawer->print_dna_sequence($dna_seq->getseq("?",true, false));
						echo "</code2><br/>Ihre Sequenz hat eine Länge von ";
						echo $dna_seq->getseq_length();
						echo " Basen!</p>";break;
					default: echo "Noch nicht implementiert!";
						}
					break;

					case 'transkription':

						require "include/seq.bio.inc.php";
						require "include/seq.gfx.inc.php";
						$dna_seq = new DNASEQUENCE($_POST["sequence"]);
						$transcribtion_seq = new RNASEQUENCE($dna_seq->getseq_trancribtion());
						$drawer = new SequenceDrawer();
						echo "<h1>Hier Ihre mRNA-Sequenz als Grafik:</h1><br/>";
						$drawer->draw_rna_sequence($transcribtion_seq->getseq());
						echo "<p class=\"rightTxt\"><br/><br/>Die mRNA-Sequenz lautet:<br/><code>";
						$drawer->print_rna_sequence($transcribtion_seq->getseq());
						echo "</code><br/>Die DNA-Sequenz lautete:<br/><code2>";
						$drawer->print_dna_sequence($dna_seq->getseq("?",true, false));
						echo "</code2><br/>Ihre Sequenz hat eine Laenge von ";
						print($transcribtion_seq->getseq_length());
						echo " Basen!</p>";

					break;
					case 'translation':
						switch($_REQUEST['raster']){
								case '1.':$raster = 0; break;
								case '2.':$raster = 1; break;
								case '3.':$raster = 2; break;}
						require "include/seq.bio.inc.php";
						require "include/seq.gfx.inc.php";
						$dna_seq = new DNASEQUENCE($_POST["sequence"]);
						$drawer = new SequenceDrawer();
						echo "<h1>Hier Ihre DNA-Sequenz umgewandelt in eine AS-Seqenz:</h1><br/><p class=\"rightTxt\"><b><code>";
						$drawer->print_as_sequence($dna_seq->getseq_translation($raster));
						echo "</code></b><br/>Die zu übersetzende DNA-Sequenz lautete:<br/><code2>";
						$drawer->print_dna_sequence($dna_seq->getseq("?",true));
						echo "</code2><br/>Ihre Sequenz hat eine Laenge von ";
						echo $dna_seq->getseq_length();
						echo " Basen!</p>";
					break;
					case 'statistik':
						require "include/seq.bio.inc.php";
						require "include/seq.gfx.inc.php";
						$dna_seq = new DNASEQUENCE($_POST["sequence"]);
						$drawer = new SequenceDrawer();
						echo "<h1>Hier die Statistik zu Ihrer Sequenz:</h1><br/><br/><p class=\"rightTxt\">";
						$drawer->print_dna_stats($dna_seq->getseq_stats());
						echo "<br/><br/>";
						$drawer->draw_dna_stats($dna_seq->getseq_stats());
						echo "<br/>Die DNA-Sequenz lautete:<br/><code2>";
						$drawer->print_dna_sequence($dna_seq->getseq());
						echo "</code2></p>";
					break;
					case 'suche':
						require "include/seq.bio.inc.php";
						require "include/seq.gfx.inc.php";
						$pattern = strtoupper($_POST["pattern"]);
						switch($_POST['type']){
							case 'DNA-Sequenz':
									$dna_seq = new DNASEQUENCE($_POST["sequence"]);
									$drawer = new SequenceDrawer();
									$dna_seq->mark_pattern($_POST["pattern"]);
									echo "<h1>Hier Ihre DNA-Sequenz mit orange eingärbten Basen (Suchmuster):</h1><br/>";
									$drawer->draw_dna_sequence($dna_seq->getseq("?", false, true));
									echo "<p class=\"rightTxt\"><br/>Das Suchmuster lautete:<br/><code>{$pattern}</code><br/>";
									echo "Es wurde <b>".$dna_seq->found_pattern($_POST["pattern"])." mal</b> gefunden!<br/>";
									echo "<br/>Die durchsuchte Sequenz lautet (Treffer sind tiefergestellt):<br/><code>";
									$drawer->print_dna_sequence($dna_seq->getseq("?",false, true));
									echo "</code><br/>Die zu dursuchende Sequenz lautete:<br/><code2>";
									$drawer->print_dna_sequence($dna_seq->getseq("?",true, false));
									echo "</code2><br/>Ihre Sequenz hat eine Laenge von ";
									echo $dna_seq->getseq_length();
									echo " Basen!</p>";break;
									break;
							case 'mRNA-Sequenz':
									$rna_seq = new RNASEQUENCE($_POST["sequence"]);
									$drawer = new SequenceDrawer();
									$rna_seq->mark_pattern($_POST["pattern"]);
									echo "<h1>Hier Ihre rna-Sequenz mit orange eingärbten Basen (Suchmuster):</h1><br/>";
									$drawer->draw_rna_sequence($rna_seq->getseq("?", false, true));
									echo "<p class=\"rightTxt\"><br/>Das Suchmuster lautete:<br/><code>{$pattern}</code><br/>";
									echo "Es wurde <b>".$rna_seq->found_pattern($_POST["pattern"])." mal</b> gefunden!<br/>";
									echo "<br/>Die durchsuchte Sequenz lautet (Treffer sind tiefergestellt):<br/><code>";
									$drawer->print_rna_sequence($rna_seq->getseq("?",false, true));
									echo "</code><br/>Die zu dursuchende Sequenz lautete:<br/><code2>";
									$drawer->print_rna_sequence($rna_seq->getseq("?",true, false));
									echo "</code2><br/>Ihre Sequenz hat eine Laenge von ";
									echo $rna_seq->getseq_length();
									echo " Basen!</p>";break;
						}
					break;
					case 'vergleich':
						require "include/seq.bio.inc.php";
						require "include/seq.gfx.inc.php";
        				require "include/salsa.bio.inc.php";
       					require "include/salsa.gfx.inc.php";

						switch($_POST['type']){
							case 'DNA-Sequenz':
									$seq1 = new DNASEQUENCE($_POST["sequence"]);
									$seq2 = new DNASEQUENCE($_POST["sequence2"]);
									$drawer = new SequenceDrawer();
        							$alignment = new SALSA($seq1, $seq2);
        							$matrix = $alignment->get_dotplot((int)$_POST["window"]);
        							echo "<h1>Hier Ihr Dotplot mit folgenden Eigenschaften: <b>Fenstergröße={$_POST['window']} Zoom={$_POST['zoom']}</b></h1><p class=\"rightTxt\">";
		 						   $alignment_drawer = new SalsaDrawer();
		  							$alignment_drawer->draw_dotplot($matrix, (int)$_POST["zoom"]);
		  							echo "<br/><br/><b>Die Sequenz-Distanz nach Levenshtein beträgt: ".$alignment->get_levenshtein()."</b>";
									echo "<br/><br/>Die 1. Sequenz lautete:<br/><code2>";
									$drawer->print_dna_sequence($seq1->getseq("?",true, false));
									echo "</code2><br/>Die 2. Sequenz lautete:<br/><code2>";
									$drawer->print_dna_sequence($seq2->getseq("?",true, false));
									echo "</code2><br/>Ihre 1. Sequenz hat eine Laenge von ";
									echo $seq1->getseq_length();
									echo " Basen!";
									echo "<br/>Ihre 2. Sequenz hat eine Laenge von ";
									echo $seq2->getseq_length();
									echo " Basen!</p>";
									break;
							case 'mRNA-Sequenz':
									$seq1 = new RNASEQUENCE($_POST["sequence"]);
									$seq2 = new RNASEQUENCE($_POST["sequence2"]);
									$drawer = new SequenceDrawer();
        							$alignment = new SALSA($seq1, $seq2);
        							$matrix = $alignment->get_dotplot((int)$_POST["window"]);
        							echo "<h1>Hier Ihr Dotplot mit folgenden Eigenschaften: <b>Fenstergröße={$_POST['window']} Zoom={$_POST['zoom']}</b></h1><p class=\"rightTxt\">";
		 						   $alignment_drawer = new SalsaDrawer();
		  							$alignment_drawer->draw_dotplot($matrix, (int)$_POST["zoom"]);
		  							echo "<br/><br/><b>Die Sequenz-Distanz nach Levenshtein beträgt: ".$alignment->get_levenshtein()."</b>";
									echo "<br/>Die 1. Sequenz lautete:<br/><code2>";
									$drawer->print_dna_sequence($seq1->getseq("?",true, false));
									echo "</code2><br/>Die 2. Sequenz lautete:<br/><code2>";
									$drawer->print_dna_sequence($seq2->getseq("?",true, false));
									echo "</code2><br/>Ihre 1. Sequenz hat eine Laenge von ";
									echo $seq1->getseq_length();
									echo " Basen!";
									echo "<br/>Ihre 2. Sequenz hat eine Laenge von ";
									echo $seq2->getseq_length();
									echo " Basen!</p>";
									break;
							case 'AS-Sequenz':
									$seq1 = new ASSEQUENCE($_POST["sequence"]);
									$seq2 = new ASSEQUENCE($_POST["sequence2"]);
									$drawer = new SequenceDrawer();
        							$alignment = new SALSA($seq1, $seq2);
        							$matrix = $alignment->get_dotplot((int)$_POST["window"]);
        							echo "<h1>Hier Ihr Dotplot mit folgenden Eigenschaften: <b>Fenstergröße={$_POST['window']} Zoom={$_POST['zoom']}</b></h1><p class=\"rightTxt\">";
		 						   $alignment_drawer = new SalsaDrawer();
		  							$alignment_drawer->draw_dotplot($matrix, (int)$_POST["zoom"]);
		  							echo "<br/><br/><b>Die Sequenz-Distanz nach Levenshtein beträgt: ".$alignment->get_levenshtein()."</b>";
									echo "<br/>Die 1. Sequenz lautete:<br/><code2>";
									$drawer->print_as_sequence($seq1->getseq(""));
									echo "</code2><br/>Die 2. Sequenz lautete:<br/><code2>";
									$drawer->print_as_sequence($seq2->getseq(""));
									echo "</code2><br/>Ihre 1. Sequenz hat eine Laenge von ";
									echo $seq1->getseq_length();
									echo " Aminosäuren!";
									echo "<br/>Ihre 2. Sequenz hat eine Laenge von ";
									echo $seq2->getseq_length();
									echo " Aminosäuren!</p>";
									break;
						}
					break;

					default:
							print_r($_REQUEST);
					}

?>
<p class="rightBottom"></p>